import 'osc_notice.dart';

class OscMessageListEntity {
	List<OscMessage> messageList;
	OscNotice notice;

	OscMessageListEntity({this.messageList, this.notice});

	OscMessageListEntity.fromJson(Map<String, dynamic> json) {
		if (json['messageList'] != null) {
			messageList = new List<OscMessage>();(json['messageList'] as List).forEach((v) { messageList.add(new OscMessage.fromJson(v)); });
		}
		notice = json['notice'] != null ? new OscNotice.fromJson(json['notice']) : null;
	}

	Map<String, dynamic> toJson() {
		final Map<String, dynamic> data = new Map<String, dynamic>();
		if (this.messageList != null) {
      data['messageList'] =  this.messageList.map((v) => v.toJson()).toList();
    }
		if (this.notice != null) {
      data['notice'] = this.notice.toJson();
    }
		return data;
	}
}

class OscMessage {
	String senderName;//发送者用户名
	int senderId;//发送者ID
	int messageCount;//来往私信数
	int friendId;//接收人ID
	int id;//私信id
	String portrait;//私信人头像
	String pubDate;//私信发送日期
	String friendName;//接收人用户名
	String content;//私信内容

	OscMessage({this.senderName, this.senderId, this.messageCount, this.friendId, this.id, this.portrait, this.pubDate, this.friendName, this.content});

	OscMessage.fromJson(Map<String, dynamic> json) {
		senderName = json['sendername'];
		senderId = json['senderid'];
		messageCount = json['messageCount'];
		friendId = json['friendid'];
		id = json['id'];
		portrait = json['portrait'];
		pubDate = json['pubDate'];
		friendName = json['friendname'];
		content = json['content'];
	}

	Map<String, dynamic> toJson() {
		final Map<String, dynamic> data = new Map<String, dynamic>();
		data['sendername'] = this.senderName;
		data['senderid'] = this.senderId;
		data['messageCount'] = this.messageCount;
		data['friendid'] = this.friendId;
		data['id'] = this.id;
		data['portrait'] = this.portrait;
		data['pubDate'] = this.pubDate;
		data['friendname'] = this.friendName;
		data['content'] = this.content;
		return data;
	}
}
